<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<h3>Add new media</h3>
	<div class="sideControlGroup">
		<p><a href="${baseUrl}/findmovie">Click here expand your collection</a></p>
	</div>

<h3>Filter on title</h3>
	<div class="sideControlGroup">
	<form action="${baseUrl}/collection" method="get">
		<p>
			<input class="cleanInput" type="text" name="search" size="26" value="${search}" />
			<input type="submit" value="find" class="submit" />
			<c:if test="${!empty search}">
				<a href="${baseUrl}/collection">clear search</a>
			</c:if>
		</p>
	</form>
	
	<c:url var="filterAll" value="/collection">
		<c:if test="${!empty search}"><c:param name="search" value="${search}" /></c:if>
		<c:if test="${!empty sortorder}"><c:param name="sortorder" value="${sortorder}" /></c:if>
	</c:url>
	<c:url var="filterMustsee" value="/collection">
		<c:if test="${!empty search}"><c:param name="search" value="${search}" /></c:if>
		<c:if test="${!empty sortorder}"><c:param name="sortorder" value="${sortorder}" /></c:if>
		<c:param name="filter" value="mustsee" />
	</c:url>
	<c:url var="filterSuggested" value="/collection">
		<c:if test="${!empty search}"><c:param name="search" value="${search}" /></c:if>
		<c:if test="${!empty sortorder}"><c:param name="sortorder" value="${sortorder}" /></c:if>
		<c:param name="filter" value="suggested" />
	</c:url>
			
	<c:choose>
		<c:when test="${empty filter || filter eq 'all'}"><span class="controlActive">all</span></c:when>
		<c:otherwise><a href="${filterAll}">all</a></c:otherwise>
	</c:choose>
	<br/>
	
	<c:choose>
		<c:when test="${!empty filter && filter eq 'mustsee'}"><span class="controlActive">mustsee</span></c:when>
		<c:otherwise><a href="${filterMustsee}">mustsee</a></c:otherwise>
	</c:choose>
	<br/>
	
	<c:choose>
		<c:when test="${!empty filter && filter eq 'suggested'}"><span class="controlActive">suggested</span></c:when>
		<c:otherwise><a href="${filterSuggested}">suggested</a></c:otherwise>
	</c:choose>
	<br/>

	</div>
		
<h3>Display options</h3>

<h4>Sort by:</h4>
	<div class="sideControlGroup">
	<p>
		<c:url var="sortReleasedate" value="/collection">
			<c:if test="${!empty search}"><c:param name="search" value="${search}" /></c:if>
			<c:if test="${!empty sortorder}"><c:param name="sortorder" value="${sortorder}" /></c:if>
			<c:if test="${!empty filter}"><c:param name="filter" value="${filter}" /></c:if>
			<c:param name="sorton" value="release" />
		</c:url>
		<c:url var="sortAlpha" value="/collection">
			<c:if test="${!empty search}"><c:param name="search" value="${search}" /></c:if>
			<c:if test="${!empty sortorder}"><c:param name="sortorder" value="${sortorder}" /></c:if>
			<c:if test="${!empty filter}"><c:param name="filter" value="${filter}" /></c:if>
			<c:param name="sorton" value="alpha" />
		</c:url>
		<c:url var="sortRating" value="/collection">
			<c:if test="${!empty search}"><c:param name="search" value="${search}" /></c:if>
			<c:if test="${!empty sortorder}"><c:param name="sortorder" value="${sortorder}" /></c:if>
			<c:if test="${!empty filter}"><c:param name="filter" value="${filter}" /></c:if>
			<c:param name="sorton" value="rating" />
		</c:url>
		
		<c:choose>
			<c:when test="${empty sorton || sorton eq 'release'}"><span class="controlActive">releasedate</span></c:when>
			<c:otherwise><a href="${sortReleasedate}">releasedate</a></c:otherwise>
		</c:choose>
		<br/>
		
		<c:choose>
			<c:when test="${!empty sorton && sorton eq 'alpha'}"><span class="controlActive">alphabetical</span></c:when>
			<c:otherwise><a href="${sortAlpha}">alphabetical</a></c:otherwise>
		</c:choose>
		<br/>
		
		<c:choose>
			<c:when test="${!empty sorton && sorton eq 'rating'}"><span class="controlActive">rating</span></c:when>
			<c:otherwise><a href="${sortRating}">rating</a></c:otherwise>
		</c:choose>
		<br/>
	</p>
	</div>
	
<h4>Sort order:</h4>
	<div class="sideControlGroup">	
	<p>		
		<c:url var="sortDesc" value="/collection">
			<c:if test="${!empty search}"><c:param name="search" value="${search}" /></c:if>
			<c:if test="${!empty sorton}"><c:param name="sorton" value="${sorton}" /></c:if>
			<c:if test="${!empty filter}"><c:param name="filter" value="${filter}" /></c:if>
			<c:param name="sortorder" value="desc" />
		</c:url>
		<c:url var="sortAsc" value="${request.requestUrl}">
			<c:if test="${!empty search}"><c:param name="search" value="${search}" /></c:if>
			<c:if test="${!empty sorton}"><c:param name="sorton" value="${sorton}" /></c:if>
			<c:if test="${!empty filter}"><c:param name="filter" value="${filter}" /></c:if>
			<c:param name="sortorder" value="asc" />
		</c:url>
		
		<c:choose>
			<c:when test="${!empty sortorder && sortorder eq 'asc'}"><span class="controlActive">ascending</span></c:when>
			<c:otherwise><a href="${sortAsc}">ascending</a></c:otherwise>
		</c:choose>
		<br/>
		
		<c:choose>
			<c:when test="${empty sortorder || sortorder eq 'desc'}"><span class="controlActive">descending</span></c:when>
			<c:otherwise><a href="${sortDesc}">descending</a></c:otherwise>
		</c:choose>
		<br/>

	</p>
	</div>
	
<h4>Records per page:</h4>
	<div class="sideControlGroup">
	<p>
		<a href="">10</a> <a href="">20</a>	<a href="">50</a> <a href="">100</a><br/>
	</p>
	</div>